import { createRouter, createWebHistory } from "vue-router";

const routes = [
     {
        path: '/',
        name: 'IndexPage',
        component: () => import('@/views/oa/index.vue'),
        meta: { title: 'OA系统' },
    }, 
    {
        path: '/XXX',
        name: 'XXXXXX',
        // component: () => import('@/views/oa/rs/index.vue'),
        meta: { title: '人事' },
        children: [
            // 1、
            {
                path: '/XXX',
                name: 'XXXXXX',
                // component: () => import('@/views/oa/rs/index.vue'),
                meta: { title: '人事子模块1' },
            },
            {
                path: '/XXX',
                name: 'XXXXXX',
                // component: () => import('@/views/oa/rs/jixiao/index.vue'),
                meta: { title: '绩效考核模块' },
            },
            // 扁平化处理，衍生绩效考核模块的子模块

            // 2、
            {
                path: '/XXX',
                name: 'XXXXXX',
                // component: () => import('@/views/oa/rs/zhaopin/index.vue'),
                meta: { title: '招聘管理模块' },
            },
            // 扁平化处理，衍生招聘管理的子模块





            // 3、
        ]
    },
    {
        path: '/XXX',
        name: 'XXXXXX',
        // component: () => import('@/views/oa/xz/index.vue'),
        meta: { title: '行政' },
        children: [
            // 1、扁平化处理，衍生招聘管理的子模块
            {
                path: '/XXX',
                name: 'XXXXXX',
                // component: () => import('@/views/oa/xz/sushe/index.vue'),
                meta: { title: '宿舍管理' },
            },



            // 2、扁平化处理，衍生招聘管理的子模块
            {
                path: '/XXX',
                name: 'XXXXXX',
                // component: () => import('@/views/oa/xz/houqin/index.vue'),
                meta: { title: '后勤管理' },
            },




            // 3、扁平化处理，衍生招聘管理的子模块
            {
                path: '/XXX',
                name: 'XXXXXX',
                // component: () => import('@/views/oa/xz/peixun/index.vue'),
                meta: { title: '培训管理' },
            },
        ]
    },

    
     {
        path: '/XXX',
        name: 'XXXXXX',
        // component: () => import('@/views/pinkong/LoginPage.vue'),
        meta: { title: '品控' },
    },
];

const router = createRouter({
    history: createWebHistory(),
    routes,
    scrollBehavior() {
        return { left: 0, top: 0 };
    },
});

// 设置页面标题
router.beforeEach((to, from, next) => {
    document.title = to.meta.title || "";
    next();
});

export default router;
